<template>
    <div>
    </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { getUserInfo } from "/@/api/backend/nuwa";
import type { AdminInfo } from '/@/stores/interface'
import { checkNuwaslogin } from '/@/utils/nuwa'
import { useAdminInfo } from '/@/stores/adminInfo'
import router from '/@/router'

const adminInfo = useAdminInfo()

onMounted(()=>{
    getUserInfo({}).then(res=>{     
        var data = res.data; 
        var AdminInfo:AdminInfo = {
            id:data.id,
            username:data.account,
            nickname:data.name,
            avatar:data.avatar,
            last_login_time:data.lastLoginTime,
            token:checkNuwaslogin(),
            refresh_token:data.jobNo,
            super:false,
        };
        adminInfo.dataFill(AdminInfo)
        router.push({ path: "/admin" })
    })
});

</script>